<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">

	var params = [];
	function init() {
			
		params = getParams();
		setInitParams();
	}
	
	function setInitParams(){
	
		var d = document.getElementById("welcomeNote");
		d.innerHTML = "Bem vindo " + params[0] + " " + params[1] + ".";	
	}
	
	function getParams(){
		var query = window.location.search
		
		if (query.substring(0, 1) == '?') {
			query = query.substring(1);
		}
		var data = query.split(',');
		
		for (i = 0; (i < data.length); i++) {
			data[i] = unescape(data[i]);
		}
		
		return data;
	}
	function nextStep() {
		
		if(!validateFields()){
			 alert("Dados inválidos");
		}
		else {
			//GUARDAR DADOS
			//var p = validateFields();
			//setCookie("IMCStep1", p, 5);
			alert("ready to go php");
			
			//window.open(sendData(validateFields()), "_self");
			//window.open("testeIMC_passo2.html","_self");
		}
	}
	
	function validateFields(){
		
		var e = document.getElementById("email");
		var d = document.getElementById("district");
		var p = document.getElementById("phone");
		
		//if(!e || !d || !p) return false;
		//else return true;
		
		return true;
	}
	
</script>
<link href="css/testesPerry.css" rel="stylesheet" type="text/css" />
</head>

<body bgcolor="#405766" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="init()">
<div id="boundary">
<div class="title" position="relative">Inquérito</div>
<br />
<div id="welcomeNote" class="welcomNoteClass">Bem vindo </div>
<hr>
<div id="inquiry" class="inquiryClass"></div>
<hr>
<div class="title" position="relative">Dados adicionais</div>
<table width="241" height="54">
<tr class="tableStyle">
  <td width="44" height="30">Email:</td>
  <td width="185"><input id="emailInput" class="inputFieldLarge" type="text" value="" /></td>
</tr>
<tr class="tableStyle">
  <td width="44" height="30">Distrito:</td>
  <td width="185"><input id="districtInput" class="inputFieldLarge" type="text" value="" /></td>
</tr>
<tr class="tableStyle">
  <td width="44" height="30">Telemóvel:</td>
  <td width="185"><input id="mobileInput" class="inputFieldLarge" type="text" value="" /></td>
</tr>
</table>
<hr align="left">
<br>
<div class="margin50px">
<a href="" class="buttonStyle" onClick="nextStep();">VER RESULTADO</a>
</div>
</div>
</body>
</html>
